package com.example.springsecurity.mapper;

import com.example.springsecurity.domain.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @ClassName AssignExperimentMapper
 * @Description TODO
 * @Author lvyongwei
 * @Date 2020-10-12 15:48
 **/
@Mapper
public interface AssignExperimentMapper {

    /**
     * 布置实验,添加布置信息
     * @param assignExperiment
     * @return
     */
    public boolean assignExperiment(AssignExperiment assignExperiment);

    /**
     * 添加某次布置的选择题id(包括单选,多选)
     * @param assignId
     * @param assignChoiceQuestions
     * @return
     */
    public boolean assignChoiceQuestion(@Param("assignId") Long assignId,@Param("assignChoiceQuestions") List<AssignChoiceQuestion> assignChoiceQuestions);

    /**
     * 添加某次布置的客观题id
     * @param assignId
     * @param assignObjectiveItems
     * @return
     */
    public boolean assignObjectiveItems(@Param("assignId") Long assignId,@Param("assignObjectiveItems") List<AssignObjectiveItem> assignObjectiveItems);

    /**
     * 本次布置实验布置给的学生
     * @param assignId
     * @param userNames
     * @return
     */
    public boolean assignUserName(@Param("assignId") Long assignId,@Param("userNames")List<String> userNames);

    /**
     * 查看当前教师/负责人布置的所有布置
     * @param userId
     * @param assignName
     * @param projectId
     * @return
     */
    public List<CheckAssign> getAllCheckAssign(@Param("userId") Long userId,@Param("assignName") String assignName,@Param("projectId") Integer projectId);

    /**
     * 获取某次布置，共布置给多少人
     * @param assignId
     * @return
     */
    public int getCheckAssignCount(@Param("assignId") Long assignId);

    /**
     * 获取某次布置，未批改多少人
     * @param assignId
     * @return
     */
    public int getCheckAssignWaitCount(@Param("assignId") Long assignId);

    /**
     * 根据布置id获取指定布置的详情
     * @param assignId
     * @return
     */
    public AssignDetails getAssignDetails(Long assignId);

    /**
     * 根据本次布置获取布置关联的学生id
     * @param assignId
     * @return
     */
    public List<String> getAllStudentByAssign(Long assignId);

    /**
     * 修改布置
     * @param assignExperiment 布置实体
     * @return
     */
    public boolean updateAssign(AssignExperiment assignExperiment);

    /**
     * 删除布置
     * @param assignId
     * @return
     */
    public boolean deleteAssign(Long assignId);

    /**
     * 删除布置，用户关联
     * @param assignId
     * @return
     */
    public boolean deleteAssignUserName(Long assignId);

    /**
     * 改变布置状态为已批改
     * @param teacherCorrectScore
     * @return
     */
    public boolean updateAccomplishCondition(TeacherCorrectScore teacherCorrectScore);

    /**
     * 添加教师批改成绩到批改表
     * @param teacherCorrectScore
     * @return
     */
    public boolean correctResult(TeacherCorrectScore teacherCorrectScore);


    /**
     * 根据提交id和布置id获取批改分数
     * @param assignId
     * @param submitId
     * @return
     */
    public TeacherCorrectScore getTeacherCorrectScore(@Param("assignId") Long assignId,@Param("submitId") Integer submitId);


    /**
     * 改变布置状态为未批改
     * @param assignId
     * @param userName
     * @return
     */
    public boolean updateAccomplishCondition2(@Param("assignId") Long assignId,@Param("userName") String userName);

    /**
     * 改变布置状态为未批改
     * @param assignId
     * @param submitId
     * @return
     */
    public boolean deleteCorrect(@Param("assignId") Long assignId,@Param("submitId") Integer submitId);

    /**
     * 导出成绩
     * @param assignId
     * @return
     */
    public List<ExportScore> exportTeacherCorrect(@Param("assignId") Long assignId);

    /**
     * 根据布置id删除教师批改情况
     * @param assignId
     * @return
     */
    public boolean deleteTeacherCorrectScore(Long assignId);
}
